package act.ein3c.in3;

import java.util.ArrayList;

public class GBNTest {
	Sender s;
	
	public static void main(String[] args){
		new GBNTest();
	}
	
	public GBNTest(){
		s  = new Sender();
		
		Thread t1 = new Thread(s);
		Thread t2 = new Thread(new Receiver());
		
		test4();
		
		
		t2.start();
		t1.start();
	}
	


	
	public void test1(){
		ArrayList<Packet> newData = new ArrayList<Packet>();
		
		newData.add(new Packet(0, "Packet 1") );

		s.setData(newData);
	}
	
	public void test2(){
		ArrayList<Packet> newData = new ArrayList<Packet>();
		
		newData.add(new Packet(0, "Packet 1") );
		newData.add(new Packet(1, "Packet 2") );
		newData.add(new Packet(2, "Packet 3") );
		newData.add(new Packet(3, "Packet 4") );

		s.setData(newData);
	}
	
	public void test3(){
		ArrayList<Packet> newData = new ArrayList<Packet>();
		
		newData.add(new Packet(0, "Packet 1") );
		newData.add(new Packet(1, "Packet 2") );
		newData.add(new Packet(2, "Packet 3") );
		newData.add(new Packet(3, "Packet 4") );
		newData.add(new Packet(4, "Packet 5") );
		newData.add(new Packet(5, "Packet 6") );
		newData.add(new Packet(6, "Packet 7") );
		newData.add(new Packet(7, "Packet 8") );
		newData.add(new Packet(8, "Packet 9") );
		newData.add(new Packet(9, "Packet 10") );
		
		s.setData(newData);
	}
	
	public void test4(){
		ArrayList<Packet> newData = new ArrayList<Packet>();
		
		newData.add(new Packet(0, "Packet 1") );
		newData.add(new Packet(2, "Packet wrong") );
		newData.add(new Packet(1, "Packet 2") );
		newData.add(new Packet(2, "Packet 3") );

		s.setData(newData);
	}
	
	public void test5(){
		ArrayList<Packet> newData = new ArrayList<Packet>();
		
		newData.add(new Packet(0, "Packet 1") );
		newData.add(new Packet(1, "Packet 2") );
		newData.add(new Packet(9, "Packet wrong") );
		newData.add(new Packet(2, "Packet 3") );
		newData.add(new Packet(3, "Packet 4") );
		newData.add(new Packet(4, "Packet 5") );
		newData.add(new Packet(5, "Packet 6") );
		newData.add(new Packet(6, "Packet 7") );
		newData.add(new Packet(7, "Packet 8") );
		newData.add(new Packet(8, "Packet 9") );
		newData.add(new Packet(9, "Packet 10") );
		
		s.setData(newData);
	}
	
	public void test6(){
		ArrayList<Packet> newData = new ArrayList<Packet>();
		
		newData.add(new Packet(0, "Packet 1") );
		newData.add(new Packet(1, "Packet 2") );
		newData.add(new Packet(2, "Packet 3") );
		newData.add(new Packet(3, "Packet 4") );
		newData.add(new Packet(3, "Packet dup 4") );
		newData.add(new Packet(3, "Packet dup 4") );
		newData.add(new Packet(3, "Packet dup 4") );
		newData.add(new Packet(4, "Packet 5") );
		newData.add(new Packet(5, "Packet 6") );
		newData.add(new Packet(6, "Packet 7") );
		newData.add(new Packet(7, "Packet 8") );
		newData.add(new Packet(8, "Packet 9") );
		newData.add(new Packet(9, "Packet 10") );
		
		s.setData(newData);
	}

	

}
